/*
sui 折叠面板组件
作者 : 深海
id:作用范围id
closeOther:是否关闭其他
showIndex:默认打开第几项
*/
sui.accordion = function(id, closeOther, showIndex) {
	if(typeof(closeOther) == 'undefined') {
		closeOther = false;
	}
	if(typeof(showIndex) == 'undefined') {
		showIndex = -1;
	}
	var index = 0;
	sui(id).find('.sui-collapse-header').each(function(cDom) {
		var accordionTitle = sui(cDom); 
		//DebugPrint({"accordionTitle" : accordionTitle});
		accordionTitle.click(function() {
			var accordionContent = sui(this).parent().find('.sui-collapse-content');
			DebugPrint({"accordionContent" : accordionContent});
			
			var accordionTitleHtml = accordionTitle.html();
			if(accordionContent.isShow()) {
				accordionContent.hide();
				accordionTitle.removeClass('sui-active');
			} else {
				if(closeOther) {
					sui(id).find('.sui-collapse-content').hide();
					sui(id).find('.sui-collapse-header').removeClass('sui-active');
				}
				accordionContent.show();
				accordionTitle.addClass('sui-active');
			}
			sui.scrollTop(0);
		});
		if(showIndex == index) {
			sui(cDom).click();
		}
		index++;
	});
};